﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Meditime.Domain
{
    public partial class StaffMember
    {
        partial void ValidateCreateStaffMember(Guid id, string name, DateTime dateOfBirth)
        {
            ValidateUpdateDateOfBirth(id, dateOfBirth);
        }

        partial void ValidateUpdateDateOfBirth(Guid id, DateTime dateOfBirth)
        {
            if (dateOfBirth.AddYears(18) > DateTime.Now)
                throw new ApplicationException("The Staff Member must be over 18 years of age.");
        }

    }
}
